package com.suket.jnn;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class NodeFactory {

  public static List createWeights( int totalWeights , Random random ) {
    List weights = new ArrayList();
    double weight;
    for ( int i = 0 ; i < totalWeights ; i++ ) {
      weight = 0.0;
      if ( random != null ) {
        weight = random.nextDouble();
      }
      weights.add(new Double(weight));
    }
    return weights;
  }

  public static Node createNode( int totalWeights , Random random ) {
    Node node = new Node();
    if ( totalWeights < 0 ) {
      return node;
    }
    List listWeights = createWeights(totalWeights, random);
    if ( listWeights != null ) {
      node.setWeights(listWeights);
    }
    return node;
  }

}
